Passed
Push — master ( 6f8171...7c2bcd )
by
unknown
48s
created

CreateEditProfileAPI.getManagerProfile   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 1
rs 10
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
7
var CreateEditProfileAPI = {};
8
9
CreateEditProfileAPI.managerProfileObj = {};
10
11
CreateEditProfileAPI.ManagerProfile = function (
12
        user_manager_profile_id,
13
        user_manager_profile_department_id,
14
        user_manager_profile_twitter,
15
        user_manager_profile_linkedin,
16
        user_id,
17
        profile_pic) {
18
    this.user_manager_profile_id = user_manager_profile_id;
19
    this.user_manager_profile_department_id = user_manager_profile_department_id;
20
    this.user_manager_profile_twitter = user_manager_profile_twitter;
21
    this.user_manager_profile_linkedin = user_manager_profile_linkedin;
22
    this.user_id = user_id,
0 ignored issues
show
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
23
            this.profile_pic = profile_pic;
0 ignored issues
show
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
24
};
25
26
CreateEditProfileAPI.ManagerProfileDetails = function (
27
        user_manager_profile_details_id,
28
        user_manager_profile_details_locale_id,
29
        user_manager_profile_details_aboutme,
30
        user_manager_profile_details_proud,
31
        user_manager_profile_details_branch,
32
        user_manager_profile_details_division,
33
        user_manager_profile_details_position,
34
        user_manager_profile_details_lead_style,
35
        user_manager_profile_details_emp_learn,
36
        user_manager_profile_details_expectations,
37
        user_manager_profile_id,
38
        user_manager_profile_review_options,
39
        user_manager_profile_staylate,
40
        user_manager_profile_engage,
41
        user_manager_profile_devops,
42
        user_manager_profile_lvwrequests,
43
        user_manager_profile_work_experience,
44
        user_manager_profile_education) {
45
    this.user_manager_profile_details_id = user_manager_profile_details_id;
46
    this.user_manager_profile_details_locale_id = user_manager_profile_details_locale_id;
47
    this.user_manager_profile_details_aboutme = user_manager_profile_details_aboutme;
48
    this.user_manager_profile_details_proud = user_manager_profile_details_proud;
49
    this.user_manager_profile_details_branch = user_manager_profile_details_branch;
50
    this.user_manager_profile_details_division = user_manager_profile_details_division;
51
    this.user_manager_profile_details_position = user_manager_profile_details_position;
52
    this.user_manager_profile_details_lead_style = user_manager_profile_details_lead_style;
53
    this.user_manager_profile_details_emp_learn = user_manager_profile_details_emp_learn;
54
    this.user_manager_profile_details_expectations = user_manager_profile_details_expectations;
55
    this.user_manager_profile_id = user_manager_profile_id;
56
    this.user_manager_profile_review_options = user_manager_profile_review_options;
57
    this.user_manager_profile_staylate = user_manager_profile_staylate;
58
    this.user_manager_profile_engage = user_manager_profile_engage;
59
    this.user_manager_profile_devops = user_manager_profile_devops;
60
    this.user_manager_profile_lvwrequests = user_manager_profile_lvwrequests;
61
    this.user_manager_profile_work_experience = user_manager_profile_work_experience;
62
    this.user_manager_profile_education = user_manager_profile_education;
63
64
};
65
66
/**
67
 *
68
 * @param {TalentCloudAPI.Content} siteContent
69
 * @return {undefined}
70
 */
71
CreateEditProfileAPI.localizeCreateEditProfile = function (siteContent) {
0 ignored issues
show
Unused Code introduced by
The parameter siteContent is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
72
    try {
73
        LookupAPI.populateDropdown("department", "createEditProfile_department");
0 ignored issues
show
Bug introduced by
The variable LookupAPI seems to be never declared. If this is a global, consider adding a /** global: LookupAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
74
    } catch (e) {
75
        (console.error || console.log).call(console, e.stack || e);
76
    }
77
};
78
79
CreateEditProfileAPI.selectedUnit = function (newID) {
80
    var option = document.getElementById(newID);
81
    option.checked = true;
82
};
83
84
//below are the functions for the tabbed layout of the 'create job poster' page for managers
85
CreateEditProfileAPI.goToStep = function (stepId) {
86
    var stepGroups = document.getElementsByClassName('stepGroup_createEditProfile');
87
    //console.log("+   " + stepGroups);
88
89
    for (var s = 0; s < stepGroups.length; s++) {
90
        var stepGroup = stepGroups[s];
91
        //console.log(stepGroup);
92
        if (!stepGroup.classList.contains('hidden')) {
93
            stepGroup.classList.add('hidden');
94
        }
95
        if (stepGroup.id === stepId) {
96
            stepGroup.classList.remove('hidden');
97
        }
98
    }
99
};
100
101
CreateEditProfileAPI.stepHighlight = function (stepID) {
102
    var s1 = document.getElementById("createJobPosterStep1Label");
103
    s1.classList.remove("create-job-poster-tab-current");
104
    var s2 = document.getElementById("createJobPosterStep2Label");
105
    s2.classList.remove("create-job-poster-tab-current");
106
    var s3 = document.getElementById("createJobPosterStep3Label");
107
    s3.classList.remove("create-job-poster-tab-current");
108
    var s4 = document.getElementById("createJobPosterStep4Label");
109
    s4.classList.remove("create-job-poster-tab-current");
110
111
    var current = document.getElementById(stepID);
112
    current.classList.add("create-job-poster-tab-current");
113
};
114
115
CreateEditProfileAPI.firstLoad = function () {
116
    DepartmentAPI.filterCreateJobPosterDepartments(true);
0 ignored issues
show
Bug introduced by
The variable DepartmentAPI seems to be never declared. If this is a global, consider adding a /** global: DepartmentAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
117
118
};
119
120
CreateEditProfileAPI.updateManagerProfileWithDetails = function () {
121
122
    var updated_manager_profile = new CreateEditProfileAPI.ManagerProfile();
123
124
    updated_manager_profile.user_id = UserAPI.getSessionUserAsJSON().user_id;
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
125
126
    updated_manager_profile.user_manager_profile_id = document.getElementById("ManagerProfileId").value;
127
128
    updated_manager_profile.user_manager_profile_department_id = document.getElementById("createEditProfile_department").value;
129
    if (updated_manager_profile.user_manager_profile_department_id === "") {
130
        //Server accepts null but not empty string ids
131
        updated_manager_profile.user_manager_profile_department_id = null;
132
    }
133
134
    updated_manager_profile.user_manager_profile_twitter = document.getElementById("createEditProfile_twitter").value;
135
    updated_manager_profile.user_manager_profile_linkedin = document.getElementById("createEditProfile_linkedin").value;
136
137
    console.log(updated_manager_profile);
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
138
139
    var updated_manager_profile_details_en = new CreateEditProfileAPI.ManagerProfileDetails();
140
    var updated_manager_profile_details_fr = new CreateEditProfileAPI.ManagerProfileDetails();
141
142
    //TODO: use locale_iso instead of locale_id; requires backend change too
143
    updated_manager_profile_details_en.user_manager_profile_details_locale_id = 1;
144
    updated_manager_profile_details_en.user_manager_profile_details_locale_id = 2;
145
146
    updated_manager_profile_details_en.user_manager_profile_details_id = document.getElementById("ManagerProfileDetailsId").value;
147
    updated_manager_profile_details_fr.user_manager_profile_details_id = document.getElementById("ManagerProfileDetailsId").value;
148
149
    updated_manager_profile_details_en.user_manager_profile_id = document.getElementById("ManagerProfileId").value;
150
    updated_manager_profile_details_fr.user_manager_profile_id = document.getElementById("ManagerProfileId").value;
151
152
    updated_manager_profile_details_en.user_manager_profile_details_aboutme = document.getElementById("createEditProfile_bio").value;
153
    updated_manager_profile_details_fr.user_manager_profile_details_aboutme = document.getElementById("createEditProfile_bio_fr").value;
154
155
    updated_manager_profile_details_en.user_manager_profile_details_proud = document.getElementById("createEditProfile_proudOf").value;
156
    updated_manager_profile_details_fr.user_manager_profile_details_proud = document.getElementById("createEditProfile_proudOf_fr").value;
157
158
    updated_manager_profile_details_en.user_manager_profile_details_branch = document.getElementById("createEditProfile_branch").value;
159
    updated_manager_profile_details_fr.user_manager_profile_details_branch = document.getElementById("createEditProfile_branch_fr").value;
160
161
    updated_manager_profile_details_en.user_manager_profile_details_division = document.getElementById("createEditProfile_division").value;
162
    updated_manager_profile_details_fr.user_manager_profile_details_division = document.getElementById("createEditProfile_division_fr").value;
163
164
    updated_manager_profile_details_en.user_manager_profile_details_position = document.getElementById("createEditProfile_position").value;
165
    updated_manager_profile_details_fr.user_manager_profile_details_position = document.getElementById("createEditProfile_position_fr").value;
166
167
    updated_manager_profile_details_en.user_manager_profile_details_lead_style = document.getElementById("createEditProfile_leadership_style").value;
168
    updated_manager_profile_details_fr.user_manager_profile_details_lead_style = document.getElementById("createEditProfile_leadership_style_fr").value;
169
170
    updated_manager_profile_details_en.user_manager_profile_details_emp_learn = document.getElementById("createEditProfile_app_to_employees").value;
171
    updated_manager_profile_details_fr.user_manager_profile_details_emp_learn = document.getElementById("createEditProfile_app_to_employees_fr").value;
172
173
    updated_manager_profile_details_en.user_manager_profile_details_expectations = document.getElementById("createEditProfile_exp_of_employees").value;
174
    updated_manager_profile_details_fr.user_manager_profile_details_expectations = document.getElementById("createEditProfile_exp_of_employees_fr").value;
175
176
    updated_manager_profile_details_en.user_manager_profile_work_experience = document.getElementById("user_manager_profile_work_experience").value;
177
    updated_manager_profile_details_fr.user_manager_profile_work_experience = document.getElementById("user_manager_profile_work_experience_fr").value;
178
179
    updated_manager_profile_details_en.user_manager_profile_education = document.getElementById("user_manager_profile_education").value;
180
    updated_manager_profile_details_fr.user_manager_profile_education = document.getElementById("user_manager_profile_education_fr").value;
181
182
183
    //Get slider option values, and default to "option0" if any NOTHING in a slider is selected, default to "option0"
184
    var defaultOption = "option0";
185
186
    var reviewSelected = document.querySelector('input[name="createEditProfile_how_often_review_options"]:checked');
187
    updated_manager_profile_details_en.user_manager_profile_review_options = (reviewSelected ? reviewSelected.value : defaultOption); //Ternary Operator
188
    updated_manager_profile_details_fr.user_manager_profile_review_options = (reviewSelected ? reviewSelected.value : defaultOption);
189
190
    var staylateSelected = document.querySelector('input[name="createEditProfile_staylate"]:checked');
191
    updated_manager_profile_details_en.user_manager_profile_staylate = (staylateSelected ? staylateSelected.value : defaultOption);
192
    updated_manager_profile_details_fr.user_manager_profile_staylate = (staylateSelected ? staylateSelected.value : defaultOption);
193
194
    var engageSelected = document.querySelector('input[name="createEditProfile_engage"]:checked');
195
    updated_manager_profile_details_en.user_manager_profile_engage = (engageSelected ? engageSelected.value : defaultOption);
196
    updated_manager_profile_details_fr.user_manager_profile_engage = (engageSelected ? engageSelected.value : defaultOption);
197
198
    var devopsSelected = document.querySelector('input[name="createEditProfile_devops"]:checked');
199
    updated_manager_profile_details_en.user_manager_profile_devops = (devopsSelected ? devopsSelected.value : defaultOption);
200
    updated_manager_profile_details_fr.user_manager_profile_devops = (devopsSelected ? devopsSelected.value : defaultOption);
201
202
    var lvwrequestSelected = document.querySelector('input[name="createEditProfile_lvwrequests"]:checked');
203
    updated_manager_profile_details_en.user_manager_profile_lvwrequests = (lvwrequestSelected ? lvwrequestSelected.value : defaultOption);
204
    updated_manager_profile_details_fr.user_manager_profile_lvwrequests = (lvwrequestSelected ? lvwrequestSelected.value : defaultOption);
205
206
207
    var complete_manager_profile = {};
208
209
    complete_manager_profile.manager_profile = updated_manager_profile;
210
211
    complete_manager_profile.manager_profile_details = {};
212
    complete_manager_profile.manager_profile_details.en_CA = updated_manager_profile_details_en;
213
    complete_manager_profile.manager_profile_details.fr_CA = updated_manager_profile_details_fr;
214
215
    CreateEditProfileAPI.saveManagerProfile(complete_manager_profile);
216
217
};
218
219
CreateEditProfileAPI.saveManagerProfile = function (complete_manager_profile) {
220
221
    var complete_manager_profileJSON = JSON.stringify(complete_manager_profile);
222
223
    if (UserAPI.hasSessionUser()) {
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
224
        var user = UserAPI.getSessionUserAsJSON();
225
        var user_id = user["user_id"];
0 ignored issues
show
Coding Style introduced by
['user_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
226
        var manager_profile_url = DataAPI.baseURL + "/postManagerProfile/" + user_id;
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
227
        DataAPI.sendRequest(manager_profile_url, 'POST', {}, complete_manager_profileJSON, function(request) {
228
            if (request.status === 200) {
229
                var response = JSON.parse(request.responseText);
230
                document.getElementById("ManagerProfileId").value = response.manager_profile_id;
231
            }
232
        });
233
    }
234
};
235
236
CreateEditProfileAPI.viewProfile = function (profileObj) {
237
238
    var engFreBreak = '///';
239
240
    var viewProfileContent = document.createElement("div");
241
    viewProfileContent.setAttribute("class", "viewProfileContent");
242
    viewProfileContent.setAttribute("id", "viewProfile_ContentID");
243
244
    //'vp' stands for view profile
245
    //Name
246
    //
247
    //About me
248
    var vp_aboutMe_div = document.createElement("div");
249
    vp_aboutMe_div.setAttribute("id", "vpAboutMeContent");
250
    var vp_aboutMe = document.createElement("div");
251
    vp_aboutMe.setAttribute("id", "vpAboutMe");
252
    vp_aboutMe.innerHTML = siteContent.aboutMe;
0 ignored issues
show
Bug introduced by
The variable siteContent seems to be never declared. If this is a global, consider adding a /** global: siteContent */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
253
254
    var vp_name = document.createElement("div");
255
    vp_name.setAttribute("id", "vpName");
256
    vp_name.innerHTML = profileObj.name;
257
258
    var vp_bio = document.createElement("div");
259
    vp_bio.setAttribute("id", "vpBio");
260
    vp_bio.innerHTML = profileObj.bio + '<br>' + engFreBreak + '<br>' + profileObj.bio_fr;
261
262
    vp_aboutMe_div.appendChild(vp_aboutMe);
263
    vp_aboutMe_div.appendChild(document.createElement("hr"));
264
    vp_aboutMe_div.appendChild(vp_name);
265
    vp_aboutMe_div.appendChild(vp_bio);
266
267
268
269
    //Gneral information
270
    var vp_generalInfo_div = document.createElement("div");
271
    vp_generalInfo_div.setAttribute("id", "vpGeneralInfoContent");
272
    vp_generalInfo_div.setAttribute("class", "viewProfileGeneralInformationPane");
273
    var vp_genInfo = document.createElement("div");
274
    vp_genInfo.setAttribute("id", "vpGenInfo");
275
    vp_genInfo.innerHTML = siteContent.generalInformation;
276
277
    //GENERAL INFO (LEFT)
278
    var vp_generalInfo_div_left = document.createElement("div");
279
    //vp_generalInfo_div_left.setAttribute("class", "viewProfileLeftPane");
280
281
    var vp_dep = document.createElement("div");
282
    vp_dep.setAttribute("id", "vpSlot_department");
283
    vp_dep.setAttribute("class", "viewProfileSlot");
284
    var vp_dep_label = document.createElement("div");
285
    vp_dep_label.innerHTML = siteContent.department;
286
    vp_dep_label.setAttribute("class", "viewProfileSlotLabel");
287
    vp_dep_label.setAttribute("id", "viewProfile_slot_dep_label");
288
    var vp_dep_content = document.createElement("div");
289
    vp_dep_content.setAttribute("class", "viewProfileSlotContent");
290
    var vp_dep_img = document.createElement("div");
291
    vp_dep_img.setAttribute("class", "viewProfileSlotImg");
292
    var vp_dep_img_tag = document.createElement("img");
293
    vp_dep_img_tag.setAttribute("src", "/images/checkmark.png");
294
    vp_dep_img_tag.setAttribute("width", "24");
295
    vp_dep_img_tag.setAttribute("height", "24");
296
    vp_dep_img.appendChild(vp_dep_img_tag);
297
    var vp_dep_value = document.createElement("div");
298
    vp_dep_value.setAttribute("class", "viewProfileSlotValue");
299
    vp_dep_value.innerHTML = profileObj.department + '<br>' + engFreBreak + '<br>' + profileObj.department_fr;
300
    vp_dep_content.appendChild(vp_dep_img);
301
    vp_dep_content.appendChild(vp_dep_value);
302
    vp_dep.appendChild(vp_dep_label);
303
    vp_dep.appendChild(vp_dep_content);
304
305
    var vp_pos = document.createElement("div");
306
    vp_pos.setAttribute("id", "vpSlot_position");
307
    vp_pos.setAttribute("class", "viewProfileSlot");
308
    var vp_pos_label = document.createElement("div");
309
    vp_pos_label.innerHTML = siteContent.position;
310
    vp_pos_label.setAttribute("class", "viewProfileSlotLabel");
311
    vp_pos_label.setAttribute("id", "viewProfile_slot_pos_label");
312
    var vp_pos_content = document.createElement("div");
313
    vp_pos_content.setAttribute("class", "viewProfileSlotContent");
314
    var vp_pos_img = document.createElement("div");
315
    vp_pos_img.setAttribute("class", "viewProfileSlotImg");
316
    var vp_pos_img_tag = document.createElement("img");
317
    vp_pos_img_tag.setAttribute("src", "/images/checkmark.png");
318
    vp_pos_img_tag.setAttribute("width", "24");
319
    vp_pos_img_tag.setAttribute("height", "24");
320
    vp_pos_img.appendChild(vp_pos_img_tag);
321
    var vp_pos_value = document.createElement("div");
322
    vp_pos_value.setAttribute("class", "viewProfileSlotValue");
323
    vp_pos_value.innerHTML = profileObj.position + '<br>' + engFreBreak + '<br>' + profileObj.position_fr;
324
    vp_pos_content.appendChild(vp_pos_img);
325
    vp_pos_content.appendChild(vp_pos_value);
326
    vp_pos.appendChild(vp_pos_label);
327
    vp_pos.appendChild(vp_pos_content);
328
329
    var vp_branch = document.createElement("div");
330
    vp_branch.setAttribute("id", "vpSlot_branch");
331
    vp_branch.setAttribute("class", "viewProfileSlot");
332
    var vp_branch_label = document.createElement("div");
333
    vp_branch_label.innerHTML = siteContent.branch;
334
    vp_branch_label.setAttribute("class", "viewProfileSlotLabel");
335
    vp_branch_label.setAttribute("id", "viewProfile_slot_branch_label");
336
    var vp_branch_content = document.createElement("div");
337
    vp_branch_content.setAttribute("class", "viewProfileSlotContent");
338
    var vp_branch_img = document.createElement("div");
339
    vp_branch_img.setAttribute("class", "viewProfileSlotImg");
340
    var vp_branch_img_tag = document.createElement("img");
341
    vp_branch_img_tag.setAttribute("src", "/images/checkmark.png");
342
    vp_branch_img_tag.setAttribute("width", "24");
343
    vp_branch_img_tag.setAttribute("height", "24");
344
    vp_branch_img.appendChild(vp_branch_img_tag);
345
    var vp_branch_value = document.createElement("div");
346
    vp_branch_value.setAttribute("class", "viewProfileSlotValue");
347
    vp_branch_value.innerHTML = profileObj.branch + '<br>' + engFreBreak + '<br>' + profileObj.branch_fr;
348
    vp_branch_content.appendChild(vp_branch_img);
349
    vp_branch_content.appendChild(vp_branch_value);
350
    vp_branch.appendChild(vp_branch_label);
351
    vp_branch.appendChild(vp_branch_content);
352
353
    var vp_division = document.createElement("div");
354
    vp_division.setAttribute("id", "vpSlot_division");
355
    vp_division.setAttribute("class", "viewProfileSlot");
356
    var vp_division_label = document.createElement("div");
357
    vp_division_label.innerHTML = siteContent.division;
358
    vp_division_label.setAttribute("class", "viewProfileSlotLabel");
359
    vp_division_label.setAttribute("id", "viewProfile_slot_division_label");
360
    var vp_division_content = document.createElement("div");
361
    vp_division_content.setAttribute("class", "viewProfileSlotContent");
362
    var vp_division_img = document.createElement("div");
363
    vp_division_img.setAttribute("class", "viewProfileSlotImg");
364
    var vp_division_img_tag = document.createElement("img");
365
    vp_division_img_tag.setAttribute("src", "/images/checkmark.png");
366
    vp_division_img_tag.setAttribute("width", "24");
367
    vp_division_img_tag.setAttribute("height", "24");
368
    vp_division_img.appendChild(vp_division_img_tag);
369
    var vp_division_value = document.createElement("div");
370
    vp_division_value.setAttribute("class", "viewProfileSlotValue");
371
    vp_division_value.innerHTML = profileObj.division + '<br>' + engFreBreak + '<br>' + profileObj.division_fr;
372
    vp_division_content.appendChild(vp_division_img);
373
    vp_division_content.appendChild(vp_division_value);
374
    vp_division.appendChild(vp_division_label);
375
    vp_division.appendChild(vp_division_content);
376
377
    //TWITTER AND LINKED IN (LEFT) //(RIGHT)
378
    //var vp_generalInfo_div_right = document.createElement("div");
379
    //vp_generalInfo_div_right.setAttribute("class", "viewProfileRightPane");
380
381
    var vp_twitter = document.createElement("div");
382
    vp_twitter.setAttribute("id", "vpSlot_twitter");
383
    vp_twitter.setAttribute("class", "viewProfileSlot");
384
    var vp_twitter_label = document.createElement("div");
385
    vp_twitter_label.innerHTML = "Twitter";//siteContent.division;
386
    vp_twitter_label.setAttribute("class", "viewProfileSlotLabel");
387
    vp_twitter_label.setAttribute("id", "viewProfile_slot_twitter_label");
388
    var vp_twitter_content = document.createElement("div");
389
    vp_twitter_content.setAttribute("class", "viewProfileSlotContent");
390
    var vp_twitter_img = document.createElement("div");
391
    vp_twitter_img.setAttribute("class", "viewProfileSlotImg");
392
    var vp_twitter_img_tag = document.createElement("img");
393
    vp_twitter_img_tag.setAttribute("src", "/images/twitter.png");
394
    vp_twitter_img_tag.setAttribute("width", "32");
395
    vp_twitter_img_tag.setAttribute("height", "32");
396
    vp_twitter_img.appendChild(vp_twitter_img_tag);
397
    var vp_twitter_value = document.createElement("div");
398
    vp_twitter_value.setAttribute("class", "viewProfileSlotValue");
399
    vp_twitter_value.innerHTML = profileObj.twitter;
400
    vp_twitter_content.appendChild(vp_twitter_img);
401
    vp_twitter_content.appendChild(vp_twitter_value);
402
    vp_twitter.appendChild(vp_twitter_label);
403
    vp_twitter.appendChild(vp_twitter_content);
404
405
    var vp_linkedin = document.createElement("div");
406
    vp_linkedin.setAttribute("id", "vpSlot_linkedin");
407
    vp_linkedin.setAttribute("class", "viewProfileSlot");
408
    var vp_linkedin_label = document.createElement("div");
409
    vp_linkedin_label.innerHTML = "LinkedIn";//siteContent.linkedin;
410
    vp_linkedin_label.setAttribute("class", "viewProfileSlotLabel");
411
    vp_linkedin_label.setAttribute("id", "viewProfile_slot_linkedin_label");
412
    var vp_linkedin_content = document.createElement("div");
413
    vp_linkedin_content.setAttribute("class", "viewProfileSlotContent");
414
    var vp_linkedin_img = document.createElement("div");
415
    vp_linkedin_img.setAttribute("class", "viewProfileSlotImg");
416
    var vp_linkedin_img_tag = document.createElement("img");
417
    vp_linkedin_img_tag.setAttribute("src", "/images/linkedin.png");
418
    vp_linkedin_img_tag.setAttribute("width", "32");
419
    vp_linkedin_img_tag.setAttribute("height", "32");
420
    vp_linkedin_img.appendChild(vp_linkedin_img_tag);
421
    var vp_linkedin_value = document.createElement("div");
422
    vp_linkedin_value.setAttribute("class", "viewProfileSlotValue");
423
    vp_linkedin_value.innerHTML = profileObj.linkedin;
424
    vp_linkedin_content.appendChild(vp_linkedin_img);
425
    vp_linkedin_content.appendChild(vp_linkedin_value);
426
    vp_linkedin.appendChild(vp_linkedin_label);
427
    vp_linkedin.appendChild(vp_linkedin_content);
428
429
    //ASSEMBLE GENERAL INFO SECTION
430
    vp_generalInfo_div.appendChild(vp_genInfo);
431
432
    vp_generalInfo_div_left.appendChild(vp_dep);
433
    vp_generalInfo_div_left.appendChild(vp_pos);
434
    vp_generalInfo_div_left.appendChild(vp_branch);
435
    vp_generalInfo_div_left.appendChild(vp_division);
436
    vp_generalInfo_div_left.appendChild(vp_twitter);
437
    vp_generalInfo_div_left.appendChild(vp_linkedin);
438
439
    vp_generalInfo_div.appendChild(document.createElement("hr"));
440
    vp_generalInfo_div.appendChild(vp_generalInfo_div_left);
441
    //vp_generalInfo_div.appendChild(vp_generalInfo_div_right);
442
443
444
    //Leadership style
445
    var vp_leadershipStyle_div = document.createElement("div");
446
    vp_leadershipStyle_div.setAttribute("id", "vpLeadershipStyleContent");
447
    var vp_leadershipStyle = document.createElement("div");
448
    vp_leadershipStyle.setAttribute("id", "vpLeadershipStyle");
449
    vp_leadershipStyle.innerHTML = siteContent.leadershipStyle;
450
451
    var vp_mystyle = document.createElement("div");
452
    vp_mystyle.setAttribute("id", "vpSlot_mystyle");
453
    vp_mystyle.setAttribute("class", "viewProfileSlot");
454
    var vp_mystyle_label = document.createElement("div");
455
    vp_mystyle_label.innerHTML = siteContent.myLeadershipStyle;
456
    vp_mystyle_label.setAttribute("class", "viewProfileSlotLabel");
457
    vp_mystyle_label.setAttribute("id", "viewProfile_slot_mystyle_label");
458
    var vp_mystyle_content = document.createElement("div");
459
    vp_mystyle_content.setAttribute("class", "viewProfileSlotContent");
460
    var vp_mystyle_img = document.createElement("div");
461
    vp_mystyle_img.setAttribute("class", "viewProfileSlotImg");
462
    var vp_mystyle_img_tag = document.createElement("img");
463
    vp_mystyle_img_tag.setAttribute("src", "/images/checkmark.png");
464
    vp_mystyle_img_tag.setAttribute("width", "24");
465
    vp_mystyle_img_tag.setAttribute("height", "24");
466
    vp_mystyle_img.appendChild(vp_mystyle_img_tag);
467
    var vp_mystyle_value = document.createElement("div");
468
    vp_mystyle_value.setAttribute("class", "viewProfileSlotValue viewProfileHeightBoost");
469
    vp_mystyle_value.innerHTML = profileObj.leadership_style + '<br>' + engFreBreak + '<br>' + profileObj.leadership_style_fr;
470
    vp_mystyle_content.appendChild(vp_mystyle_img);
471
    vp_mystyle_content.appendChild(vp_mystyle_value);
472
    vp_mystyle.appendChild(vp_mystyle_label);
473
    vp_mystyle.appendChild(vp_mystyle_content);
474
475
    var vp_myapp = document.createElement("div");
476
    vp_myapp.setAttribute("id", "vpSlot_myapp");
477
    vp_myapp.setAttribute("class", "viewProfileSlot");
478
    var vp_myapp_label = document.createElement("div");
479
    vp_myapp_label.innerHTML = siteContent.myApproachToEmployee;
480
    vp_myapp_label.setAttribute("class", "viewProfileSlotLabel");
481
    vp_myapp_label.setAttribute("id", "viewProfile_slot_myapp_label");
482
    var vp_myapp_content = document.createElement("div");
483
    vp_myapp_content.setAttribute("class", "viewProfileSlotContent");
484
    var vp_myapp_img = document.createElement("div");
485
    vp_myapp_img.setAttribute("class", "viewProfileSlotImg");
486
    var vp_myapp_img_tag = document.createElement("img");
487
    vp_myapp_img_tag.setAttribute("src", "/images/checkmark.png");
488
    vp_myapp_img_tag.setAttribute("width", "24");
489
    vp_myapp_img_tag.setAttribute("height", "24");
490
    vp_myapp_img.appendChild(vp_myapp_img_tag);
491
    var vp_myapp_value = document.createElement("div");
492
    vp_myapp_value.setAttribute("class", "viewProfileSlotValue viewProfileHeightBoost");
493
    vp_myapp_value.innerHTML = profileObj.app_to_employees + '<br>' + engFreBreak + '<br>' + profileObj.app_to_employees_fr;
494
    vp_myapp_content.appendChild(vp_myapp_img);
495
    vp_myapp_content.appendChild(vp_myapp_value);
496
    vp_myapp.appendChild(vp_myapp_label);
497
    vp_myapp.appendChild(vp_myapp_content);
498
499
    var vp_myexp = document.createElement("div");
500
    vp_myexp.setAttribute("id", "vpSlot_myapp");
501
    vp_myexp.setAttribute("class", "viewProfileSlot");
502
    var vp_myexp_label = document.createElement("div");
503
    vp_myexp_label.innerHTML = siteContent.myExpectationsOfEmployees;
504
    vp_myexp_label.setAttribute("class", "viewProfileSlotLabel");
505
    vp_myexp_label.setAttribute("id", "viewProfile_slot_myapp_label");
506
    var vp_myexp_content = document.createElement("div");
507
    vp_myexp_content.setAttribute("class", "viewProfileSlotContent");
508
    var vp_myexp_img = document.createElement("div");
509
    vp_myexp_img.setAttribute("class", "viewProfileSlotImg");
510
    var vp_myexp_img_tag = document.createElement("img");
511
    vp_myexp_img_tag.setAttribute("src", "/images/checkmark.png");
512
    vp_myexp_img_tag.setAttribute("width", "24");
513
    vp_myexp_img_tag.setAttribute("height", "24");
514
    vp_myexp_img.appendChild(vp_myexp_img_tag);
515
    var vp_myexp_value = document.createElement("div");
516
    vp_myexp_value.setAttribute("class", "viewProfileSlotValue viewProfileHeightBoost");
517
    vp_myexp_value.innerHTML = profileObj.exp_of_employees + '<br>' + engFreBreak + '<br>' + profileObj.exp_of_employees_fr;
518
    vp_myexp_content.appendChild(vp_myexp_img);
519
    vp_myexp_content.appendChild(vp_myexp_value);
520
    vp_myexp.appendChild(vp_myexp_label);
521
    vp_myexp.appendChild(vp_myexp_content);
522
523
524
    //ASSEMBLE LEADERSHIP STYLE SECTION
525
    vp_leadershipStyle_div.appendChild(vp_leadershipStyle);
526
    vp_leadershipStyle_div.appendChild(document.createElement("hr"));
527
    vp_leadershipStyle_div.appendChild(vp_mystyle);
528
    vp_leadershipStyle_div.appendChild(vp_myapp);
529
    vp_leadershipStyle_div.appendChild(vp_myexp);
530
531
    //Radio buttons
532
    var vp_decisionMaking_div = document.createElement("div");
533
    vp_decisionMaking_div.setAttribute("id", "vpDecisionMakingContent");
534
    var vp_decisionMaking = document.createElement("div");
535
    vp_decisionMaking.setAttribute("id", "vpDecisionMaking");
536
    vp_decisionMaking.innerHTML = siteContent.myApproachToDecisionMaking;
537
538
    var vp_howOftenReview = document.createElement("div");
539
    var reviewVal = siteContent.howOftenDoYouReview + '&nbsp;   ' + profileObj.how_often_review;
540
    vp_howOftenReview.innerHTML = reviewVal;
541
542
    var vp_howOftenEarly = document.createElement("div");
543
    var earlyVal = siteContent.howOftenDoYouStayLate + '&nbsp;   ' + profileObj.how_often_early;
544
    vp_howOftenEarly.innerHTML = earlyVal;
545
    //if(profileObj.howOftenReview === 1)
546
547
    //vp_howOftenReview.innerHTML = reviewVal;
548
549
    //ASSEMBLE DECISION MAKING STYLE
550
    vp_decisionMaking_div.appendChild(vp_decisionMaking);
551
    vp_decisionMaking_div.appendChild(document.createElement("hr"));
552
    vp_decisionMaking_div.appendChild(vp_howOftenReview);
553
    vp_decisionMaking_div.appendChild(document.createElement("br"));
554
    vp_decisionMaking_div.appendChild(vp_howOftenEarly);
555
556
    //////////////////
557
    //AddSections to the view profile container
558
    /////////////////
559
    //Addf the about me div
560
    viewProfileContent.appendChild(document.createElement("br"));
561
    viewProfileContent.appendChild(document.createElement("br"));
562
    viewProfileContent.appendChild(vp_aboutMe_div);
563
564
    //Add the general information div
565
    viewProfileContent.appendChild(document.createElement("br"));
566
    viewProfileContent.appendChild(document.createElement("br"));
567
    viewProfileContent.appendChild(vp_generalInfo_div);
568
569
    //Add the leadership style div
570
    viewProfileContent.appendChild(document.createElement("br"));
571
    viewProfileContent.appendChild(document.createElement("br"));
572
    viewProfileContent.appendChild(vp_leadershipStyle_div);
573
574
    //Add decisin making
575
    viewProfileContent.appendChild(document.createElement("br"));
576
    viewProfileContent.appendChild(document.createElement("br"));
577
    viewProfileContent.appendChild(vp_decisionMaking_div);
578
579
    return viewProfileContent;
580
581
};
582
583
CreateEditProfileAPI.showCreateEditProfile = function () {
584
    var stateInfo = {pageInfo: 'create_edit_profile', pageTitle: 'Talent Cloud: Create/Edit Profile'};
585
    document.title = stateInfo.pageTitle;
586
    history.pushState(stateInfo, stateInfo.pageInfo, '#CreateEditProfile');
0 ignored issues
show
Bug introduced by
The variable history seems to be never declared. If this is a global, consider adding a /** global: history */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
587
588
    TalentCloudAPI.hideAllContent();
0 ignored issues
show
Bug introduced by
The variable TalentCloudAPI seems to be never declared. If this is a global, consider adding a /** global: TalentCloudAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
589
590
    var createEditProfile = document.getElementById("createEditProfileSection");
591
    createEditProfile.classList.remove("hidden");
592
593
    ProfilePicAPI.refreshUserProfilePic(document.getElementById("myProfilePic"));
0 ignored issues
show
Bug introduced by
The variable ProfilePicAPI seems to be never declared. If this is a global, consider adding a /** global: ProfilePicAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
594
595
    CreateEditProfileAPI.getManagerProfile();
596
597
    // New Subpage Hero Scripts
598
599
    Utilities.getHeroElements();
0 ignored issues
show
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
600
601
    var profileHeroTitle = document.getElementById("profileHeroTitle");
602
    profileHeroTitle.classList.remove("hidden");
603
    profileHeroTitle.setAttribute("aria-hidden", "false");
604
605
    // Google Analytics
606
607
    ga('set', 'page', '/admin/my-profile');
608
    ga('send', 'pageview');
609
610
};
611
612
CreateEditProfileAPI.showViewProfile = function (linkElement) {
0 ignored issues
show
Unused Code introduced by
The parameter linkElement is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
613
    var stateInfo = {pageInfo: 'manager_view_profile', pageTitle: 'Talent Cloud: View Profile'};
614
    document.title = stateInfo.pageTitle;
615
    history.pushState(stateInfo, stateInfo.pageInfo, '#ViewProfile');
0 ignored issues
show
Bug introduced by
The variable history seems to be never declared. If this is a global, consider adding a /** global: history */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
616
617
    //Temp prifle obj
618
    var tempProfileObj = {name: 'John Dore',
619
        bio: 'BIo in englsih',
620
        bio_fr: 'BIo in French',
621
        position: 'Position In English',
622
        position_fr: 'Position in French',
623
        department: 'Department in Enlgish',
624
        department_fr: 'Department in French',
625
        branch_fr: 'Branch name in French',
626
        branch: 'Branch name in English',
627
        division: 'The division (in English)',
628
        division_fr: 'The division (in french)',
629
        twitter: 'Twitter Link',
630
        linkedin: 'LinkedIn Link',
631
        leadership_style: 'Leadership style in English',
632
        leadership_style_fr: 'Leadership Style in French',
633
        app_to_employees: 'Approach to employees',
634
        app_to_employees_fr: 'Approach to employees french',
635
        exp_of_employees: 'Expectations of employees',
636
        exp_of_employees_fr: 'Expectations of emplyoees in the second language',
637
        how_often_review: 'Almost Never',
638
        how_often_early: 'Usually'
639
    };
640
641
    EventsAPI.hideAllLayouts();
0 ignored issues
show
Bug introduced by
The variable EventsAPI seems to be never declared. If this is a global, consider adding a /** global: EventsAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
642
643
    var createEditProfile = document.getElementById("createEditProfileSection");
644
    createEditProfile.classList.remove("hidden");
645
646
    var viewProfileElement = document.getElementById("viewProfile");
647
    viewProfileElement.classList.remove("hidden");
648
649
    viewProfileElement.innerHTML = '';
650
    viewProfileElement.appendChild(CreateEditProfileAPI.viewProfile(tempProfileObj));
651
};
652
653
CreateEditProfileAPI.hideViewProfile = function (linkElement) {
0 ignored issues
show
Unused Code introduced by
The parameter linkElement is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
654
    var stateInfo = {pageInfo: 'talent_cloud', pageTitle: 'Talent Cloud'};
655
    document.title = stateInfo.pageTitle;
656
    history.replaceState(stateInfo, stateInfo.pageInfo, '/admin/#');
0 ignored issues
show
Bug introduced by
The variable history seems to be never declared. If this is a global, consider adding a /** global: history */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
657
658
    EventsAPI.hideAllLayouts();
0 ignored issues
show
Bug introduced by
The variable EventsAPI seems to be never declared. If this is a global, consider adding a /** global: EventsAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
659
660
    var content = document.getElementById("homePageContentSection");
661
    content.classList.remove("hidden");
662
663
    var active = document.getElementById("homeLinkListItem");
0 ignored issues
show
Unused Code introduced by
The variable active seems to be never used. Consider removing it.
Loading history...
664
    homeLinkListItem.classList.add("active");
0 ignored issues
show
Bug introduced by
The variable homeLinkListItem seems to be never declared. If this is a global, consider adding a /** global: homeLinkListItem */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
665
666
    var inactive = document.getElementById("profileLinkListItem");
0 ignored issues
show
Unused Code introduced by
The variable inactive seems to be never used. Consider removing it.
Loading history...
667
    profileLinkListItem.classList.remove("active");
0 ignored issues
show
Bug introduced by
The variable profileLinkListItem seems to be never declared. If this is a global, consider adding a /** global: profileLinkListItem */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
668
669
    window.scrollTo(0, 0);
670
    document.getElementById("skipNav").focus();
671
};
672
673
CreateEditProfileAPI.profilePicUploader = null;
674
675
CreateEditProfileAPI.showUploadProfilePic = function () {
676
    //document.body.style.overflow = "hidden";
677
    var uploadOverlay = document.getElementById('profilePicUploadOverlay');
678
    uploadOverlay.classList.remove("hidden");
679
    // ManagerEventsAPI.setFormFocus("profilePicUploadField");
680
681
    // var fileField = document.getElementById('profilePicUploadField');
682
    // var fileDrop = document.getElementById('profilePicUploadDrop');
683
    // var previewImage = document.getElementById('fileUploadPreviewImg');
684
    // var clearBtn = document.getElementById('profilePicUploadClear');
685
    // var uploadBtn = document.getElementById('profilePicUploadBtn');
686
    // CreateEditProfileAPI.profilePicUploader = new ProfilePicAPI.Uploader(
687
    //         [fileField],
688
    //         fileDrop,
689
    //         previewImage,
690
    //         clearBtn,
691
    //         uploadBtn,
692
    //         UserAPI.getSessionUserAsJSON().user_id,
693
    //         CreateEditProfileAPI.onProfilePicUploaded
694
    //     );
695
696
    AccessibilityAPI.focusElement("updateProfileChoosePhotoButtonLabel");
0 ignored issues
show
Bug introduced by
The variable AccessibilityAPI seems to be never declared. If this is a global, consider adding a /** global: AccessibilityAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
697
698
    EventsAPI.hideBodyOverflow(true);
0 ignored issues
show
Bug introduced by
The variable EventsAPI seems to be never declared. If this is a global, consider adding a /** global: EventsAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
699
700
    var fileInputButtons = [document.getElementById('updateProfileChoosePhotoButton'),
701
        document.getElementById('updateProfileChooseAltPhotoButton')];
702
    var fileDrop = document.getElementById('updateProfilePhotoDraggableArea');
703
    var imagePreview = document.getElementById('updateProfilePhotoCroppieContainer');
704
    var clearBtn = document.getElementById('updateProfilePhotoCancelButton');
705
    var uploadBtn = document.getElementById('profilePicUploadBtn');
706
707
    //Don't pass in a save button, because there is no dedicated button for pic uploading.
708
    //The save button must upload photo, as well as profile info.
709
    JobSeekerAPI.profilePicUploader = new ProfilePicAPI.Uploader(
0 ignored issues
show
Bug introduced by
The variable ProfilePicAPI seems to be never declared. If this is a global, consider adding a /** global: ProfilePicAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
The variable JobSeekerAPI seems to be never declared. If this is a global, consider adding a /** global: JobSeekerAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
710
            fileInputButtons,
711
            fileDrop,
712
            imagePreview,
713
            clearBtn,
714
            uploadBtn,
715
            UserAPI.getSessionUserAsJSON().user_id,
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
716
            CreateEditProfileAPI.onProfilePicUploaded
717
            );
718
719
    modalSize();
720
721
};
722
723
CreateEditProfileAPI.hideUploadProfilePic = function () {
724
    document.body.style.overflow = "";
725
    document.body.classList.remove("overFlowHidden");
726
    var uploadOverlay = document.getElementById('profilePicUploadOverlay');
727
    uploadOverlay.classList.add("hidden");
728
    CreateEditProfileAPI.profilePicUploader = null;
729
};
730
731
CreateEditProfileAPI.onProfilePicUploaded = function () {
732
    ProfilePicAPI.refreshUserProfilePic(document.getElementById("myProfilePic"));
0 ignored issues
show
Bug introduced by
The variable ProfilePicAPI seems to be never declared. If this is a global, consider adding a /** global: ProfilePicAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
733
    CreateEditProfileAPI.hideUploadProfilePic();
734
};
735
736
CreateEditProfileAPI.getManagerProfile = function () {
737
738
    if (UserAPI.hasSessionUser()) {
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
739
        var user = UserAPI.getSessionUserAsJSON();
740
        var user_id = user["user_id"];
0 ignored issues
show
Coding Style introduced by
['user_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
741
        var manager_profile_url = DataAPI.baseURL + "/getManagerProfile/" + user_id;
0 ignored issues
show
Bug introduced by
The variable DataAPI seems to be never declared. If this is a global, consider adding a /** global: DataAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
742
        DataAPI.sendRequest(manager_profile_url, 'GET', {}, null, function(request) {
743
            if (request.status === 200) {
744
                CreateEditProfileAPI.populateProfile(request.response);
745
            }
746
        });
747
    }
748
};
749
750
CreateEditProfileAPI.userLoaded = function (response) {
751
    var user_json = JSON.parse(response);
752
    var user = new UserAPI.User();
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
753
    user.id = user_json['id'];
0 ignored issues
show
Coding Style introduced by
['id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
754
755
};
756
757
CreateEditProfileAPI.populateProfile = function (response) {
758
    var manager_profile_with_details_json = JSON.parse(response);
759
760
    var manager_profile_json = manager_profile_with_details_json["manager_profile"];
0 ignored issues
show
Coding Style introduced by
['manager_profile'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
761
762
    var profile_details_json_en = manager_profile_with_details_json["manager_profile_details"]["en_CA"];
0 ignored issues
show
Coding Style introduced by
['manager_profile_details'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
Coding Style introduced by
['en_CA'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
763
    var profile_details_json_fr = manager_profile_with_details_json["manager_profile_details"]["fr_CA"];
0 ignored issues
show
Coding Style introduced by
['manager_profile_details'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
Coding Style introduced by
['fr_CA'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
764
765
    var manager_profile = new CreateEditProfileAPI.ManagerProfile();
766
767
    manager_profile.user_id = manager_profile_json["user_id"];
0 ignored issues
show
Coding Style introduced by
['user_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
768
    manager_profile.user_manager_profile_id = manager_profile_json["user_manager_profile_id"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
769
    manager_profile.user_manager_profile_department_id = manager_profile_json["user_manager_profile_department_id"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_department_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
770
    manager_profile.user_manager_profile_twitter = manager_profile_json["user_manager_profile_twitter"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_twitter'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
771
    manager_profile.user_manager_profile_linkedin = manager_profile_json["user_manager_profile_linkedin"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_linkedin'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
772
773
    var manager_profile_details_en = new CreateEditProfileAPI.ManagerProfileDetails();
774
    var manager_profile_details_fr = new CreateEditProfileAPI.ManagerProfileDetails();
775
776
    manager_profile_details_en.user_manager_profile_details_id = profile_details_json_en["user_manager_profile_details_id"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
777
    manager_profile_details_en.locale_id = profile_details_json_en["locale_id"];
0 ignored issues
show
Coding Style introduced by
['locale_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
778
    manager_profile_details_en.user_manager_profile_details_aboutme = profile_details_json_en["user_manager_profile_details_aboutme"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_aboutme'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
779
    manager_profile_details_fr.user_manager_profile_details_aboutme = profile_details_json_fr["user_manager_profile_details_aboutme"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_aboutme'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
780
    manager_profile_details_en.user_manager_profile_details_proud = profile_details_json_en["user_manager_profile_details_proud"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_proud'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
781
    manager_profile_details_fr.user_manager_profile_details_proud = profile_details_json_fr["user_manager_profile_details_proud"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_proud'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
782
    manager_profile_details_en.user_manager_profile_details_division = profile_details_json_en["user_manager_profile_details_division"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_division'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
783
    manager_profile_details_fr.user_manager_profile_details_division = profile_details_json_fr["user_manager_profile_details_division"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_division'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
784
    manager_profile_details_en.user_manager_profile_details_branch = profile_details_json_en["user_manager_profile_details_branch"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_branch'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
785
    manager_profile_details_fr.user_manager_profile_details_branch = profile_details_json_fr["user_manager_profile_details_branch"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_branch'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
786
    manager_profile_details_en.user_manager_profile_details_position = profile_details_json_en["user_manager_profile_details_position"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_position'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
787
    manager_profile_details_fr.user_manager_profile_details_position = profile_details_json_fr["user_manager_profile_details_position"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_position'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
788
    manager_profile_details_en.user_manager_profile_details_lead_style = profile_details_json_en["user_manager_profile_details_lead_style"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_lead_style'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
789
    manager_profile_details_fr.user_manager_profile_details_lead_style = profile_details_json_fr["user_manager_profile_details_lead_style"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_lead_style'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
790
    manager_profile_details_en.user_manager_profile_details_emp_learn = profile_details_json_en["user_manager_profile_details_emp_learn"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_emp_learn'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
791
    manager_profile_details_fr.user_manager_profile_details_emp_learn = profile_details_json_fr["user_manager_profile_details_emp_learn"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_emp_learn'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
792
    manager_profile_details_en.user_manager_profile_details_expectations = profile_details_json_en["user_manager_profile_details_expectations"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_expectations'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
793
    manager_profile_details_fr.user_manager_profile_details_expectations = profile_details_json_fr["user_manager_profile_details_expectations"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_details_expectations'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
794
795
    manager_profile_details_en.user_manager_profile_id = profile_details_json_en["user_manager_profile_id"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_id'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
796
    manager_profile_details_en.user_manager_profile_review_options = profile_details_json_en["user_manager_profile_review_options"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_review_options'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
797
    manager_profile_details_en.user_manager_profile_staylate = profile_details_json_en["user_manager_profile_staylate"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_staylate'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
798
    manager_profile_details_en.user_manager_profile_engage = profile_details_json_en["user_manager_profile_engage"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_engage'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
799
    manager_profile_details_en.user_manager_profile_devops = profile_details_json_en["user_manager_profile_devops"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_devops'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
800
    manager_profile_details_en.user_manager_profile_lvwrequests = profile_details_json_en["user_manager_profile_lvwrequests"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_lvwrequests'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
801
802
    manager_profile_details_en.user_manager_profile_work_experience = profile_details_json_en["user_manager_profile_work_experience"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_work_experience'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
803
    manager_profile_details_fr.user_manager_profile_work_experience = profile_details_json_fr["user_manager_profile_work_experience"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_work_experience'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
804
    manager_profile_details_en.user_manager_profile_education = profile_details_json_en["user_manager_profile_education"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_education'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
805
    manager_profile_details_fr.user_manager_profile_education = profile_details_json_fr["user_manager_profile_education"];
0 ignored issues
show
Coding Style introduced by
['user_manager_profile_education'] could be written in dot notation.

You can rewrite this statement in dot notation:

var obj = { };
obj['foo'] = 'bar'; // Bad
obj.foo = 'bar'; // Good
Loading history...
806
807
808
    //Initialize Work Environment
809
    CreateWorkEnvironmentAPI.initializeWorkEnvironmentForm(manager_profile.user_manager_profile_id);
0 ignored issues
show
Bug introduced by
The variable CreateWorkEnvironmentAPI seems to be never declared. If this is a global, consider adding a /** global: CreateWorkEnvironmentAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
810
811
    //Initialize Team Culture
812
    EditTeamCultureAPI.initializeTeamCultureForm(manager_profile.user_manager_profile_id);
0 ignored issues
show
Bug introduced by
The variable EditTeamCultureAPI seems to be never declared. If this is a global, consider adding a /** global: EditTeamCultureAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
813
814
    //set hidden field values
815
    var UserId = document.getElementById("UserId");
816
    if (manager_profile.user_id) {
817
        UserId.value = manager_profile.user_id;
818
    } else {
819
        UserId.value = "";
820
    }
821
822
    var managerProfileId = document.getElementById("ManagerProfileId");
823
    if (manager_profile.user_manager_profile_id) {
824
        managerProfileId.value = manager_profile.user_manager_profile_id;
825
    } else {
826
        managerProfileId.value = "";
827
    }
828
829
    var managerProfileDetailsId = document.getElementById("ManagerProfileDetailsId");
830
    if (manager_profile_details_en.user_manager_profile_details_id) {
831
        managerProfileDetailsId.value = manager_profile_details_en.user_manager_profile_details_id;
832
    } else {
833
        managerProfileDetailsId.value = "";
834
    }
835
836
    var createEditProfile_name_preview = document.getElementById("createEditProfile_name_preview");
837
    if (UserAPI.hasSessionUser()) {
0 ignored issues
show
Bug introduced by
The variable UserAPI seems to be never declared. If this is a global, consider adding a /** global: UserAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
838
        var session_user = UserAPI.getSessionUserAsJSON();
839
        createEditProfile_name_preview.innerHTML = session_user.name;
840
    }
841
842
    //About Me (page 1)
843
    var createEditProfile_bio = document.getElementById("createEditProfile_bio");
844
    if (createEditProfile_bio) {
845
        createEditProfile_bio.value = manager_profile_details_en.user_manager_profile_details_aboutme;
846
    } else {
847
        createEditProfile_bio.value = "";
848
    }
849
850
    var createEditProfile_bio_fr = document.getElementById("createEditProfile_bio_fr");
851
    if (createEditProfile_bio_fr) {
852
        createEditProfile_bio_fr.value = manager_profile_details_fr.user_manager_profile_details_aboutme;
853
    } else {
854
        createEditProfile_bio_fr.value = "";
855
    }
856
857
    var createEditProfile_proudOf = document.getElementById("createEditProfile_proudOf");
858
    if (createEditProfile_proudOf) {
859
        createEditProfile_proudOf.value = manager_profile_details_en.user_manager_profile_details_proud;
860
    } else {
861
        createEditProfile_proudOf.value = "";
862
    }
863
864
    var createEditProfile_proudOf_fr = document.getElementById("createEditProfile_proudOf_fr");
865
    if (createEditProfile_proudOf_fr) {
866
        createEditProfile_proudOf_fr.value = manager_profile_details_fr.user_manager_profile_details_proud;
867
    } else {
868
        createEditProfile_proudOf_fr.value = "";
869
    }
870
871
    var createEditProfile_branch = document.getElementById("createEditProfile_branch");
872
    if (createEditProfile_branch) {
873
        createEditProfile_branch.value = manager_profile_details_en.user_manager_profile_details_branch;
874
    } else {
875
        createEditProfile_branch.value = "";
876
    }
877
878
    var createEditProfile_branch_fr = document.getElementById("createEditProfile_branch_fr");
879
    if (createEditProfile_branch_fr) {
880
        createEditProfile_branch_fr.value = manager_profile_details_fr.user_manager_profile_details_branch;
881
    } else {
882
        createEditProfile_branch_fr.value = "";
883
    }
884
885
    var createEditProfile_division = document.getElementById("createEditProfile_division");
886
    if (createEditProfile_division) {
887
        createEditProfile_division.value = manager_profile_details_en.user_manager_profile_details_division;
888
    } else {
889
        createEditProfile_division.value = "";
890
    }
891
892
    var createEditProfile_division_fr = document.getElementById("createEditProfile_division_fr");
893
    if (createEditProfile_division_fr) {
894
        createEditProfile_division_fr.value = manager_profile_details_fr.user_manager_profile_details_division;
895
    } else {
896
        createEditProfile_division_fr.value = "";
897
    }
898
899
    var createEditProfile_position = document.getElementById("createEditProfile_position");
900
    if (createEditProfile_position) {
901
        createEditProfile_position.value = manager_profile_details_en.user_manager_profile_details_position;
902
    } else {
903
        createEditProfile_position.value = "";
904
    }
905
906
    var createEditProfile_position_fr = document.getElementById("createEditProfile_position_fr");
907
    if (createEditProfile_position_fr) {
908
        createEditProfile_position_fr.value = manager_profile_details_fr.user_manager_profile_details_position;
909
    } else {
910
        createEditProfile_position_fr.value = "";
911
    }
912
913
    if (locale === "en_CA") {
0 ignored issues
show
Bug introduced by
The variable locale seems to be never declared. If this is a global, consider adding a /** global: locale */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
914
        var createEditProfile_position_preview = document.getElementById("createEditProfile_position_preview");
915
        createEditProfile_position_preview.innerHTML = manager_profile_details_en.user_manager_profile_details_position;
916
    } else {
917
        var createEditProfile_position_preview = document.getElementById("createEditProfile_position_preview");
0 ignored issues
show
Comprehensibility Naming Best Practice introduced by
The variable createEditProfile_position_preview already seems to be declared on line 914. Consider using another variable name or omitting the var keyword.

This check looks for variables that are declared in multiple lines. There may be several reasons for this.

In the simplest case the variable name was reused by mistake. This may lead to very hard to locate bugs.

If you want to reuse a variable for another purpose, consider declaring it at or near the top of your function and just assigning to it subsequently so it is always declared.

Loading history...
Bug introduced by
It seems like createEditProfile_position_preview was already defined.
Loading history...
918
        createEditProfile_position_preview.innerHTML = manager_profile_details_fr.user_manager_profile_details_position;
919
    }
920
921
    var createEditProfile_twitter = document.getElementById("createEditProfile_twitter");
922
    if (createEditProfile_twitter) {
923
        createEditProfile_twitter.value = manager_profile_json.user_manager_profile_twitter;
924
    } else {
925
        createEditProfile_twitter.value = "";
926
    }
927
928
    var createEditProfile_linkedin = document.getElementById("createEditProfile_linkedin");
929
    if (createEditProfile_linkedin) {
930
        createEditProfile_linkedin.value = manager_profile_json.user_manager_profile_linkedin;
931
    } else {
932
        createEditProfile_linkedin.value = "";
933
    }
934
935
    var profile_department_id = manager_profile_json.user_manager_profile_department_id;
936
    if (profile_department_id) {
937
        var dept_select = document.getElementById("createEditProfile_department");
938
        dept_select.value = profile_department_id;
939
    }
940
941
    //Leadership style (page 2)
942
    var createEditProfile_leadership_style = document.getElementById("createEditProfile_leadership_style");
943
    if (createEditProfile_leadership_style) {
944
        createEditProfile_leadership_style.value = manager_profile_details_en.user_manager_profile_details_lead_style;
945
    } else {
946
        createEditProfile_leadership_style.value = "";
947
    }
948
949
    var createEditProfile_leadership_style_fr = document.getElementById("createEditProfile_leadership_style_fr");
950
    if (createEditProfile_leadership_style_fr) {
951
        createEditProfile_leadership_style_fr.value = manager_profile_details_fr.user_manager_profile_details_lead_style;
952
    } else {
953
        createEditProfile_leadership_style_fr.value = "";
954
    }
955
956
    var createEditProfile_app_to_employees = document.getElementById("createEditProfile_app_to_employees");
957
    if (createEditProfile_app_to_employees) {
958
        createEditProfile_app_to_employees.value = manager_profile_details_en.user_manager_profile_details_emp_learn;
959
    } else {
960
        createEditProfile_app_to_employees.value = "";
961
    }
962
963
    var createEditProfile_app_to_employees_fr = document.getElementById("createEditProfile_app_to_employees_fr");
964
    if (createEditProfile_app_to_employees_fr) {
965
        createEditProfile_app_to_employees_fr.value = manager_profile_details_fr.user_manager_profile_details_emp_learn;
966
    } else {
967
        createEditProfile_app_to_employees_fr.value = "";
968
    }
969
970
    var createEditProfile_exp_of_employees = document.getElementById("createEditProfile_exp_of_employees");
971
    if (createEditProfile_exp_of_employees) {
972
        createEditProfile_exp_of_employees.value = manager_profile_details_en.user_manager_profile_details_expectations;
973
    } else {
974
        createEditProfile_exp_of_employees.value = "";
975
    }
976
977
    var createEditProfile_exp_of_employees_fr = document.getElementById("createEditProfile_exp_of_employees_fr");
978
    if (createEditProfile_exp_of_employees_fr) {
979
        createEditProfile_exp_of_employees_fr.value = manager_profile_details_fr.user_manager_profile_details_expectations;
980
    } else {
981
        createEditProfile_exp_of_employees_fr.value = "";
982
    }
983
984
    //Multiple choice slider questions
985
    SliderAPI.selectOptionByValue('createEditProfile_how_often_review_options', manager_profile_details_en.user_manager_profile_review_options, 'review_options');
0 ignored issues
show
Bug introduced by
The variable SliderAPI seems to be never declared. If this is a global, consider adding a /** global: SliderAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
986
    SliderAPI.selectOptionByValue('createEditProfile_staylate', manager_profile_details_en.user_manager_profile_staylate, 'staylate');
987
    SliderAPI.selectOptionByValue('createEditProfile_engage', manager_profile_details_en.user_manager_profile_engage, 'engage');
988
    SliderAPI.selectOptionByValue('createEditProfile_devops', manager_profile_details_en.user_manager_profile_devops, 'devops');
989
    SliderAPI.selectOptionByValue('createEditProfile_lvwrequests', manager_profile_details_en.user_manager_profile_lvwrequests, 'lvwRequests');
990
    SliderAPI.selectOptionByValue('createEditProfile_telework', manager_profile_details_en.user_manager_profile_telework, 'telework');
991
    SliderAPI.selectOptionByValue('createEditProfile_flexHours', manager_profile_details_en.user_manager_profile_flexHours, 'flexHours');
992
993
    //Other (page 3)
994
    var user_manager_profile_work_experience = document.getElementById("user_manager_profile_work_experience");
995
    if (user_manager_profile_work_experience) {
996
        user_manager_profile_work_experience.value = manager_profile_details_en.user_manager_profile_work_experience;
997
    } else {
998
        user_manager_profile_work_experience.value = "";
999
    }
1000
1001
    var user_manager_profile_work_experience_fr = document.getElementById("user_manager_profile_work_experience_fr");
1002
    if (user_manager_profile_work_experience_fr) {
1003
        user_manager_profile_work_experience_fr.value = manager_profile_details_fr.user_manager_profile_work_experience;
1004
    } else {
1005
        user_manager_profile_work_experience_fr.value = "";
1006
    }
1007
1008
    var user_manager_profile_education = document.getElementById("user_manager_profile_education");
1009
    if (user_manager_profile_education) {
1010
        user_manager_profile_education.value = manager_profile_details_en.user_manager_profile_education;
1011
    } else {
1012
        user_manager_profile_education.value = "";
1013
    }
1014
1015
    var user_manager_profile_education_fr = document.getElementById("user_manager_profile_education_fr");
1016
    if (user_manager_profile_education_fr) {
1017
        user_manager_profile_education_fr.value = manager_profile_details_fr.user_manager_profile_education;
1018
    } else {
1019
        user_manager_profile_education_fr.value = "";
1020
    }
1021
1022
};
1023
1024
1025
// Functions for saving each step of the manager profile
1026
CreateEditProfileAPI.validateAboutMe = function () {
1027
    var valid = true;
1028
1029
    if (valid) {
1030
        Utilities.debug ? console.log(CreateEditProfileAPI.managerProfileObj) : null;
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
1031
        CreateEditProfileAPI.updateManagerProfileWithDetails();
1032
    }
1033
    CreateEditProfileAPI.goToStep('createEditProfile_step2');
1034
}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
1035
1036
CreateEditProfileAPI.validateLeadership = function () {
1037
    var valid = true;
1038
1039
    if (valid) {
1040
        Utilities.debug ? console.log(CreateEditProfileAPI.managerProfileObj) : null;
0 ignored issues
show
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
1041
        CreateEditProfileAPI.updateManagerProfileWithDetails();
1042
    }
1043
    CreateEditProfileAPI.goToStep('createEditProfile_workEnvironment');
1044
}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
1045
1046
CreateEditProfileAPI.validateWorkEnvironment = function () {
1047
    var valid = true;
1048
1049
    if (valid) {
1050
        var managerProfileId = document.getElementById("ManagerProfileId").value;
1051
        CreateWorkEnvironmentAPI.saveWorkEnvironment(managerProfileId);
0 ignored issues
show
Bug introduced by
The variable CreateWorkEnvironmentAPI seems to be never declared. If this is a global, consider adding a /** global: CreateWorkEnvironmentAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1052
    }
1053
    CreateEditProfileAPI.goToStep('createEditProfile_teamCulture');
1054
}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
1055
1056
CreateEditProfileAPI.validateTeamCulture = function () {
1057
    var valid = true;
1058
1059
    if (valid) {
1060
        var managerProfileId = document.getElementById("ManagerProfileId").value;
1061
        EditTeamCultureAPI.submitTeamCulture(managerProfileId);
0 ignored issues
show
Bug introduced by
The variable EditTeamCultureAPI seems to be never declared. If this is a global, consider adding a /** global: EditTeamCultureAPI */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
1062
    }
1063
    CreateEditProfileAPI.goToStep('createEditProfile_step3');
1064
}
0 ignored issues
show
Coding Style introduced by
There should be a semicolon.

Requirement of semicolons purely is a coding style issue since JavaScript has specific rules about semicolons which are followed by all browsers.

Further Readings:

Loading history...
1065
1066
CreateEditProfileAPI.validateOther = function () {
1067
    var valid = true;
1068
1069
    if (valid) {
1070
        Utilities.debug ? console.log(CreateEditProfileAPI.managerProfileObj) : null;
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
Bug introduced by
The variable Utilities seems to be never declared. If this is a global, consider adding a /** global: Utilities */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Bug introduced by
Did you forget to assign or call a function?

This error message can for example pop up if you forget to assign the result of a function call to a variable or pass it to another function:

function someFunction(x) {
    (x > 0) ? callFoo() : callBar();
}

// JSHint expects you to assign the result to a variable:
function someFunction(x) {
    var rs = (x > 0) ? callFoo() : callBar();
}

// If you do not use the result, you could also use if statements in the
// case above.
function someFunction(x) {
    if (x > 0) {
        callFoo();
    } else {
        callBar();
    }
}
Loading history...
Configuration introduced by
There were too many errors found in this file; checking aborted after 99%.

If JSHint finds too many errors in a file, it aborts checking altogether because it suspects a configuration issue.

Further Reading:

Loading history...
1071
        CreateEditProfileAPI.updateManagerProfileWithDetails();
1072
    }
1073
}
1074